<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<html>
<head>
<jsp:include page="/include/header.jsp"></jsp:include>
</head>
<body>
<jsp:include page="/include/site-header.jsp"></jsp:include>
<div id="container">
<jsp:include page="/include/left-content.jsp"></jsp:include>
<div id="content">
<jsp:include page="/include/menu.jsp"></jsp:include>
<div id="main">

<%-- ページ本体 begin --%>

<h1>あなたのボット</h1>
<c:forEach var="bot" items="${ bots }">
	<div id="bot-${ f:key(bot.key) }" class="bot-area">
		<a href="${ f:url('/bot/update/') }?key=${ f:key(bot.key) }">
		${ f:h(bot.name) }
		</a>
	</div>
<hr/>
</c:forEach>
<c:if test="${ fn:length(bots) == 0 }">
ボットがいません。
</c:if>

<p>
<a href="${ f:url('/bot/create/') }" class="button">あたらしくボットを作る</a>
</p>

<%-- ページ本体 end --%>

</div>
<jsp:include page="/include/copyright.jsp"></jsp:include>
</div>
<jsp:include page="/include/right-content.jsp"></jsp:include>
<div id="clear"></div>
</div>
<jsp:include page="/include/footer.jsp"></jsp:include>
<script type="text/javascript">
$(function() {
	$(".bot-area").each(function() {
		var key = $(this).attr("id").substring(4);
		$.getJSON("${ f:url('/json/bot') }", { key: key }, function(data) {
			alert(data);
		});
	});
});
</script>
</body>
</html>
